package com.usian.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@Controller  //返回页面 用
//@RestController //以json格式返回给前端
public class IndexController {

    @RequestMapping("/index")
    public String index(Model model){

        model.addAttribute("name","张三");
        model.addAttribute("date",new Date());
        return "index";
    }
}
